using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace DungeonOfDespair
{
    public class Effect
        : Entity
    {
        private Effects m_effects;
        private Sprite m_sprite;
        private int m_iSize;
        private int m_iCurrentSize;

        public Effect(Effects effects, Image image, int iSize)
        {
            m_effects = effects;
            m_sprite = new Sprite(image);
            m_iSize = iSize;
            m_iCurrentSize = m_iSize;
        }

        public override void Update()
        {
            base.Update();
            if (m_iCurrentSize > 0)
                --m_iCurrentSize;
            else
                m_bActive = false;
        }

        public override void Draw(Graphics graphics)
        {
            m_sprite.X = X;
            m_sprite.Y = Y;

            float fFactor = (float) m_iCurrentSize / m_iSize;
            m_sprite.Opacity = fFactor;

            float fScale = (1.0f - fFactor) * m_iSize / 5;
            m_sprite.CentreHotspot(ClipPosition.Middle);
            m_sprite.ResetShape();
            m_sprite.Scale(fScale, fScale);

            m_sprite.Draw(graphics);
        }
    }
}
